import 'package:flutter/material.dart';

class Widget_Drawer_UserAccountsDrawerHeader_Page extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return Widget_Drawer_UserAccountsDrawerHeader_State();
  }
}


/**
    const UserAccountsDrawerHeader({
    Key key,
    this.decoration,//
    this.margin = const EdgeInsets.only(bottom: 8.0),//
    this.currentAccountPicture,//用来设置当前用户的头像
    this.otherAccountsPictures,//用来设置当前用户的其他账号的头像
    @required this.accountName,//当前用户的姓名
    @required this.accountEmail,//当前用户的邮箱
    this.onDetailsPressed//当 accountName 或者 accountEmail 被点击的时候所触发的回调函数，可以用来显示其他额外的信息
    })
 */

class Widget_Drawer_UserAccountsDrawerHeader_State
    extends State<Widget_Drawer_UserAccountsDrawerHeader_Page> {


  @override
  Widget build(BuildContext context) {
    var userAccountsDrawerHeader = UserAccountsDrawerHeader(
        accountName: Text("张三"),
        accountEmail: Text("123456@163.com"),
        currentAccountPicture: CircleAvatar(
          backgroundImage: NetworkImage(
              "http://img8.zol.com.cn/bbs/upload/23765/23764201.jpg"),
        ),
        otherAccountsPictures: <Widget>[
          CircleAvatar(
            backgroundImage: NetworkImage(
                "http://img8.zol.com.cn/bbs/upload/23765/23764201.jpg"),
          ),
          CircleAvatar(
            backgroundImage: NetworkImage(
                "http://img8.zol.com.cn/bbs/upload/23765/23764201.jpg"),
          ),
        ],
        onDetailsPressed: () {
          print("!!!!!!!!");
        }
    );


    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("Drawer"),
        ),
        body: Container(
          color: Color(0xff00ff00),
        ),
        drawer: Drawer(
          child: ListView(
            children: <Widget>[

              userAccountsDrawerHeader,

              ListTile(
                title: Text("Title1"),
                subtitle: Text("Title1  subtitle"),
                leading: CircleAvatar(
                  child: Icon(Icons.home),
                ),
                onTap: () => print("Title1"),
              ),
              ListTile(
                title: Text("Title2"),
                leading: CircleAvatar(
                  child: Icon(Icons.alarm),
                ),
                selected: true,
                trailing: Icon(Icons.add),

                onTap: () => print("Title2"),
              ),
              ListTile(
                title: Text("Title3"),
                leading: CircleAvatar(
                  child: Icon(Icons.add),
                ),
                onTap: () => print("Title3"),
                enabled: false,
              ),
            ],
          ),
        ),
      ),
    );
  }
}

